package com.dhb.pattern.observer.gper;

import com.dhb.pattern.observer.Question;

import java.util.Observable;
import java.util.Observer;

/**
 * 功能描述：观察者
 * 创建人：citymoon
 * 创建日期：2019/5/26
 */
public class Teacher implements Observer {

    private String name;
    public Teacher(String name){
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        GPer gPer = (GPer)o;
        Question question = (Question)arg;
        System.out.println(name + "老师， 你好！ \n" +
                "您收到了一个来自“" + gPer.getName() + "”的提问， 希望您解答， 问题内容如下： \n" +
                question.getContent() + "\n" + "提问者：" + question.getUserName());
    }
}
